package com.hj.homework;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class Test3 {
    public static void main(String[] args) {
            double num = Math.random() * 100;
            System.out.println("随机数为：" +num);
            BigDecimal num1=BigDecimal.valueOf(num);
            BigDecimal num2=num1.divide(BigDecimal.valueOf(1),2, RoundingMode.DOWN);
            String str = String.valueOf(num2);
            System.out.println("截取小数点后两位后为：" + str);
    }
}
